const { DECIMALS, INITIAL_ANSWER, developmentChains } = require("../help-hardhat-config");
module.exports = async function ({ getNamedAccounts, deployments }) {

    if (developmentChains.includes(hre.network.name)) {
        // 通过名字可以调用这两个账户
        const firstAccount = (await getNamedAccounts()).firstAccount;
        const secondAccount = (await getNamedAccounts()).secondAccount;
        // console.log("firstAccount", firstAccount);
        // console.log("secondAccount", secondAccount);

        const { deploy } = deployments;

        // 可以用deploy函数来部署合约
        await deploy("MockV3Aggregator", {
            from: firstAccount,
            args: [DECIMALS, INITIAL_ANSWER],
            log: true
        });
    } else {
        console.log("MockV3Aggregator deploy skipped");
    }
}

module.exports.tags = ["all", "mock"];